/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.mobiubiq.directory.client.object.io;

import org.mobiubiq.directory.client.object.ObjectType;

/**
 *
 * @author Marnix Renne
 */
public final class ObjectReaderWriterFactory {
    private static ObjectReaderWriter locationReaderWriter = new LocationObjectReaderWriter();
    private static ObjectReaderWriter tagReaderWriter = new TagObjectReaderWriter();
    private static ObjectReaderWriter barcodeReaderWriter = new BarcodeObjectReaderWriter();
    
    private ObjectReaderWriterFactory() {
        super();
    }
    
    public static final ObjectReaderWriter get(ObjectType type) {
        if(type == ObjectType.LOCATION) {
            return locationReaderWriter;
        }
        if(type == ObjectType.BARCODE) {
            return barcodeReaderWriter;
        }
        if(type == ObjectType.TAG) {
            return tagReaderWriter;
        }
        throw new IllegalArgumentException("Unknown object type: '" + type.toString() + "'");
    }
}
